package Thread;

public class ThreadDemo2 {
    private static boolean flag = true;
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            long start = System.currentTimeMillis();
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            while(flag){
                System.out.println("hello");
            }
            long stop = System.currentTimeMillis();
            System.out.println(stop-start);
        });
        t.start();
        flag = false;
    }
}
